package tech.yunland.shop.domain.model;

import com.alibaba.fastjson.annotation.JSONField;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by v on 17-5-12.
 */
@Entity
@Table(name = "allot_bill_entry")
public class AllotBillEntry extends BillEntry{
    @JSONField(serialize = false)
    @ManyToOne
    protected AllotBill owner;

    @Column(name = "state")
    private Integer state;

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time")
    private Date createTime = new Date();

    @Transient
    private String sn; //所属单号

    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Transient
    private Date allotDate;

    @Transient
    private String allotType;

    @Transient
    private String creator;

    @Transient
    private Integer ownerState;

    @Transient
    private String ownerRemark;

    @Transient
    private String goodsUnit;

    @Column(name = "allot_price")
    private BigDecimal allotPrice = BigDecimal.ZERO;

    public AllotBill getOwner() {
        return owner;
    }

    public void setOwner(AllotBill owner) {
        this.owner = owner;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public Date getAllotDate() {
        return allotDate;
    }

    public void setAllotDate(Date allotDate) {
        this.allotDate = allotDate;
    }

    public String getAllotType() {
        return allotType;
    }

    public void setAllotType(String allotType) {
        this.allotType = allotType;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public Integer getOwnerState() {
        return ownerState;
    }

    public void setOwnerState(Integer ownerState) {
        this.ownerState = ownerState;
    }

    public String getOwnerRemark() {
        return ownerRemark;
    }

    public void setOwnerRemark(String ownerRemark) {
        this.ownerRemark = ownerRemark;
    }

    public String getGoodsUnit() {
        return this.goods == null?this.goodsUnit:this.goods.getUnit();
    }

    public void setGoodsUnit(String goodsUnit) {
        this.goodsUnit = goodsUnit;
    }

    public BigDecimal getAllotPrice() {
        return allotPrice;
    }

    public void setAllotPrice(BigDecimal allotPrice) {
        this.allotPrice = allotPrice;
    }
}
